﻿using System;

namespace block_explorer.NoiseSystem.Nodes
{
    class Clamp : INode
    {
        INode mSource;
        double mLow;
        double mHigh;

        public Clamp(INode source, double low, double high)
        {
            mSource = source;
            mLow = low;
            mHigh = high;
        }

        public double Value(double x, double y, double z)
        {
            return Math.Max(mLow, Math.Min(mHigh, mSource.Value(x, y, z)));
        }

    }
}
